#!/bin/bash
#to recover data from obs with specify date,the last two parameters is vhostname and es's indexname,if not assignment,it will use the resource/conf.properties parameters in the jar
#指定时间段将清华镜像中的数据推送到es
startdate="$1"
date1=$(date -d "$1" "+%s")
date2=$(date -d "$2" "+%s")
date_count=$(echo "$date2 - $date1"|bc)
day_m=$(echo "$date_count"/86400|bc)
for ((sdate=0;sdate<"$day_m";sdate++))
do
        month=$(date -d "$startdate $sdate days" "+%m")
        day=$(date -d "$startdate $sdate days" "+%d")
        /opt/client/Spark/spark/bin/spark-submit --class com.huawei.morrirsLog.dealMorrirsLogs --num-executors 1 --executor-cores 6 --master yarn-cluster /root/om-bigdatamirrorlog-1.0-SNAPSHOT.jar GJK7VGQW4KI5MBSMOE2Q Dim9rM3uivK1gFv7gBGT80G7oLWpOt2JTPTjBFeY 6 obs://mirrorlog/mirrors.log-2020$month$day demo mirror_openeuler app_$month_$day
        echo $month $day have done

done
